package com.chapp.util;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chapp.R;
import com.chapp.base.Artist;
import com.github.droidfu.widgets.WebImageView;

public class ArtistAdapter extends BaseAdapter {

	private Context context;
	private LayoutInflater layoutInflater;
	private Artist artist;

	public ArtistAdapter(Context context, Artist artist) {
		this.context = context;
		this.layoutInflater = (LayoutInflater) this.context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.artist = artist;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View m_view = convertView;

		if (m_view == null) {
			// Artist item = (Artist) getItem(position);//
			// this.item_list.get(position);

			m_view = layoutInflater.inflate(R.layout.artist_venue_list_items,
					null);

			TextView caption = (TextView) m_view.findViewById(R.id.title_item);
			caption.setText(artist.getName());

			WebImageView photo = (WebImageView) m_view
					.findViewById(R.id.image_item);
			if (artist.getThumbnailURL() == null
					|| artist.getThumbnailURL().equals(""))
				photo.setNoImageDrawable(R.drawable.icon);
			else {
				photo.setImageUrl(artist.getThumbnailURL());
				photo.loadImage();
			}
			return m_view;
		}
		return null;
	}
}
